//
//  StrategySecondTableViewCell.m
//  ITrip
//
//  Created by dllo on 15/5/26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StrategySecondTableViewCell.h"


@implementation StrategySecondTableViewCell

- (void)dealloc
{
    [self.second_name_zh_cn_Label release];
    [self.second_name_en_Label release];
    [self.secondimageView release];
    [self.strategyButton release];
    [self.journeyButton release];
    [self.addressButton release];
    [self.topicButton release];
    [super dealloc];
}

- (void) setStrategySecondModel:(StrategySecondModel *)strategySecondModel
{
    self.second_name_zh_cn_Label.text = strategySecondModel.second_name_zh_cn;
    self.second_name_en_Label.text = strategySecondModel.second_name_en;
    [self.secondimageView setImageWithURL:[NSURL URLWithString:strategySecondModel.second_image_url] placeholderImage:[UIImage imageNamed:@"defaultPic_Down"]];
    if (!strategySecondModel.wiki_app_publish) {
        [self.strategyButton setTitle:@"游  记" forState:UIControlStateNormal];
        self.strategyButtonTag = 2;
    } else {
        self.strategyButtonTag = 1;
        [self.strategyButton setTitle:@"攻  略" forState:UIControlStateNormal];
    }
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMyView];
    }
    return self;
}

- (void)createMyView
{
    self.secondimageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.secondimageView];
    
    self.second_name_zh_cn_Label = [[UILabel alloc]init];
    [self.secondimageView addSubview:self.second_name_zh_cn_Label];
    
    self.second_name_en_Label = [[UILabel alloc]init];
    [self.secondimageView addSubview:self.second_name_en_Label];
    
    self.strategyButton = [[UIButton alloc]init];
    [self.contentView addSubview:self.strategyButton];
    
    self.journeyButton = [[UIButton alloc]init];
    [self.contentView addSubview:self.journeyButton];
    
    self.addressButton = [[UIButton alloc]init];
    [self.contentView addSubview:self.addressButton];
    
    self.topicButton = [[UIButton alloc]init];
    [self.contentView addSubview:self.topicButton];
    
    
    [self.secondimageView release];
    [self.second_name_zh_cn_Label release];
    [self.second_name_en_Label release];
    [self.strategyButton release];
    [self.journeyButton release];
    [self.addressButton release];
    [self.topicButton release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.secondimageView.frame = CGRectMake(0, 0, self.frame.size.width, 210);
    self.secondimageView.backgroundColor = [UIColor whiteColor];
    
    self.second_name_zh_cn_Label.frame = CGRectMake(10, 10, 200, 30);
    self.second_name_zh_cn_Label.backgroundColor = [UIColor clearColor];
    self.second_name_zh_cn_Label.textColor = [UIColor whiteColor];
    self.second_name_zh_cn_Label.font = [UIFont boldSystemFontOfSize:20];
    
    self.second_name_en_Label.frame = CGRectMake(10, 35, 120, 30);
    self.second_name_en_Label.backgroundColor = [UIColor clearColor];
    self.second_name_en_Label.textColor = [UIColor whiteColor];
    self.second_name_en_Label.font = [UIFont systemFontOfSize:15];
    

  

    self.strategyButton.frame = CGRectMake(0, 210, self.frame.size.width / 4, 70);

    self.strategyButton.backgroundColor = [UIColor whiteColor];
//    [self.strategyButton setTitle:@"攻 略" forState:UIControlStateNormal];
    [self.strategyButton setImage:[UIImage imageNamed:@"iconfont-dengpao"] forState:UIControlStateNormal];
    [self.strategyButton setTitleEdgeInsets:UIEdgeInsetsMake(40, -25, 0, 0)];
    [self.strategyButton setImageEdgeInsets:UIEdgeInsetsMake(0, 25, 25, 20)];
    [self.strategyButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    self.journeyButton.frame = CGRectMake(self.frame.size.width / 4, 210, self.frame.size.width / 4, 70);
    self.journeyButton.backgroundColor = [UIColor whiteColor];
    [self.journeyButton setTitle:@"行 程" forState:UIControlStateNormal];
    [self.journeyButton setImage:[UIImage imageNamed:@"iconfont-xianlu"] forState:UIControlStateNormal];
    [self.journeyButton setTitleEdgeInsets:UIEdgeInsetsMake(40, -30, 0, 0)];
    [self.journeyButton setImageEdgeInsets:UIEdgeInsetsMake(0, 20, 25, 20)];
    [self.journeyButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    self.addressButton.frame = CGRectMake(self.frame.size.width / 2, 210, self.frame.size.width / 4, 70);
    self.addressButton.backgroundColor = [UIColor whiteColor];
    [self.addressButton setTitle:@"旅行地" forState:UIControlStateNormal];
    [self.addressButton setImage:[UIImage imageNamed:@"iconfont-huilvxing"] forState:UIControlStateNormal];
    [self.addressButton setTitleEdgeInsets:UIEdgeInsetsMake(40, -30, 0, 0)];
    [self.addressButton setImageEdgeInsets:UIEdgeInsetsMake(0, 25, 25, 20)];
    [self.addressButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    self.topicButton.frame = CGRectMake(self.frame.size.width / 4 * 3, 210, self.frame.size.width / 4, 70);
    self.topicButton.backgroundColor = [UIColor whiteColor];
    [self.topicButton setTitle:@"专 题" forState:UIControlStateNormal];
    [self.topicButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.topicButton setImage:[UIImage imageNamed:@"iconfont-remenzhuanti"] forState:UIControlStateNormal];
    [self.topicButton setTitleEdgeInsets:UIEdgeInsetsMake(40, -30, 0, 0)];
    [self.topicButton setImageEdgeInsets:UIEdgeInsetsMake(0, 25, 25, 20)];
    
   
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
